/*
 * @Author: sean
 * @Date:   2019-12-26 12:04:29
 * @Last Modified by:   sean
 * @Last Modified time: 2019-12-26 12:08:45
 */
const modulesFiles = require.context('./', true, /index\.vue$/);

const modules = modulesFiles.keys().reduce((modules, moduleDir) => {

    const modulePath = moduleDir.replace(/^\.\/(.*)\.\w+$/, '$1')

    let moduleArr = modulePath.split('/');

    if (moduleArr.length === 2) {
        let group = moduleArr[0];
        modules[group] = modulesFiles(moduleDir);
    }
    return modules
}, {})

export default modules